package com.lengyue.imakiba.logic;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.lengyue.imakiba.data.Type;

public class TypeLogic {
	/**
	 * 取得所有的动漫类型
	 * @return
	 */
	public static List<Type> getAllTypesAndSort()
	{
		return Type.dao.find("select * from type order by sort_no");
	}
	/**
	 * 根据动漫类型Id删除动漫类型，并删除动漫类型表中的对应关系
	 * @param id 动漫类型Id
	 */
	public static void deleteTypeById(int id)
	{
		Db.update("delete from anime_type where type_code = ?",id);
		Db.update("delete from type where type_code = ?",id);
	}
}
